/**
 * 浏览器效果
 */
try{
    MUI.toggleAdvancedEffects(location.href);
}
catch(e){
}

/**
 * 页面进程
 */
window.addEvent('load',function()
{
	//事件-载入登录窗口
    void function()
    {
        new MUI.Modal(
        {
            type:'window',
            closable:false,
            draggable:false,
            resizable:false,
            scrollbars:false,
            addClass:'jsonExample',
            shadowBlur:'5',
            id: 'json03',
            title: '请填写用户名及密码',
            contentURL: 'login.dialog.php',
            width: 290,
            height:305,
            method:'xhr'
        });
    }.delay();

    //事件绑定-验证码刷新
    window.setTimeout(function()
    {
        var captcha=$('CaptchaImage');
        var captchaLink=captcha.src;
        captcha.addEvent('click',function()
        {
            captcha.src=captchaLink+'?'+Math.random();
        });

        $('RefreshCaptcha').addEvent('click',function()
        {
            captcha.src=captchaLink+'?'+Math.random();
        });
    },100);

    //事件绑定-表单提交
    window.setTimeout(function()
    {
        $('Form_Login').addEvent('submit',function()
        {
            if(this.Username.value=='')
            {
                MochaUI.notification('请填写用户名');
                this.Username.focus();
                return false;
            }

            if(this.Password.value=='')
            {
                MochaUI.notification('请填写密码');
                this.Password.focus();
                return false;
            }

            if(this.Captcha.value=='')
            {
                MochaUI.notification_custom('请填写验证码');
                this.Captcha.focus();
                return false;
            }
        });
    },100)
});